home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / program / swags_z.zip / SCROLL.SWG / 0003_SCROLL3.PAS.pas < prev    next >
Pascal/Delphi Source File  |  1993-05-28  |  4KB  |  122 lines

  1. {
  2.  Here is some demo code showing how to use Smooth.Obj.  It offers
  3.  vertical and horizontal smooth scrolling in Text or Graphics modes.
  4.  
  5.  NOTE:      Requires Smooth.Obj (see below)   EGA & VGA ONLY !!!!
  6.  
  7.  REQUIRES:  Smooth.Obj  Run the debug script through DEBUG to create
  8.             Smooth.Obj.  The NEXT message has the debug script.
  9.  
  10.  ALSO:      Until last week, I'd never seen a line of Pascal code.
  11.             So ForGIVE the rough edges of this code:  bear in mind
  12.             the Complete novice status of its author <!!G!!>           }
  13.  
  14. Uses Crt;
  15.  
  16. { NOTE:  SmoothScroll is a MEDIUM MODEL Asm/OBJ For use in
  17.          **either** Pascal or most flavors of modern BASIC.
  18.  
  19.          It expects parameters to be passed by reference!  We handle
  20.          that here by not including Var, then passing Ofs(parameter).
  21.  
  22.          Don't know if this is appropriate, but it works. Comments?   }
  23.  
  24. {$F+} Procedure SmoothScroll(Row, Column: Integer); external; {$F-}
  25. {$L Smooth.Obj}
  26.  
  27. Var
  28.    Row, Col, Speed, WhichWay : Integer;
  29.    Ch : Char;
  30.    s  : String [60];
  31.  
  32. begin
  33.    TextColor (14); TextBackground (0); ClrScr;
  34.  
  35.    GotoXY (25,4);  Write ('Press <Escape> to move on.');
  36.  
  37.    ch := 'A';
  38.    For Row := 10 to 24 do
  39.        begin
  40.          FillChar (s, Sizeof(s), ch);
  41.          s[0] := #60;  Inc (ch);
  42.          GotoXY (10, Row); Write (s);
  43.        end;
  44.  
  45.    Speed := 1;                         { Change Speed!  See notes. }
  46.  
  47.    {The higher the Speed, the faster the scroll.
  48.         Use Speed = 1 For subtle scrolling.
  49.         Try Speed = 5 (10 in Graphics) For very fast scrolling.
  50.         Try Speed = 10+ (25 in gfx) to see some **Real shaking**.
  51.  
  52.         Even in Text mode here, Row and Column use GraphICS MODE
  53.         pixel coordinates (ie., begin w/ 0,0).   }
  54.  
  55.    {================================= demo vertical smooth scrolling}
  56.    Row := 0; Col := 0;
  57.    WhichWay := Speed;                   { start by going up }
  58.  
  59.    Repeat                               { press any key to end demo }
  60.       GotoXY (2,10);  Write (Row, ' ');
  61.       SmoothScroll(ofs(Row), ofs(Col));
  62.       Row := Row + WhichWay;
  63.  
  64.       if (Row > 150) or (Row < 2) then  { try 400 here }
  65.          WhichWay := WhichWay * -1;     { reverse direction }
  66.  
  67.       if Row < 1 then Row := 1;
  68.  
  69.    Until KeyPressed;
  70.  
  71.    ch := ReadKey; Row := 0; Col := 0;
  72.    SmoothScroll ( ofs(Row), ofs(Col) ); { return to normal (sort of) }
  73.  
  74.    {================================= demo horizontal smooth scrolling}
  75.    Row := 0; Col := 0;
  76.    WhichWay := Speed;                   { start by going left }
  77.  
  78.    Repeat                               { press any key to end demo }
  79.       GotoXY (38,3); Write (Col, ' ');
  80.       SmoothScroll(ofs(Row), ofs(Col));
  81.       Col := Col + WhichWay;
  82.  
  83.       if (Col > 65) or (Col < 0) then   { try 300 here }
  84.          WhichWay := WhichWay * -1;     { reverse direction }
  85.       if Col < 0 then Col := 0;
  86.    Until KeyPressed;
  87.  
  88.    Row := 0; Col := 0; SmoothScroll(ofs(Row), ofs(Col));
  89. end.
  90.  
  91. { Capture the following to a File (eg. S.Scr).
  92.  then:    DEBUG < S.SCR.
  93.  
  94.  Debug will create SMOOTH.OBJ.
  95.  
  96.  N SMOOTH.OBJ
  97.  E 0100 80 0E 00 0C 73 6D 74 68 73 63 72 6C 2E 61 73 6D
  98.  E 0110 87 96 27 00 00 06 44 47 52 4F 55 50 0D 53 4D 54
  99.  E 0120 48 53 43 52 4C 5F 54 45 58 54 04 44 41 54 41 04
  100.  E 0130 43 4F 44 45 05 5F 44 41 54 41 90 98 07 00 48 89
  101.  E 0140 00 03 05 01 87 98 07 00 48 00 00 06 04 01 0E 9A
  102.  E 0150 04 00 02 FF 02 5F 90 13 00 00 01 0C 53 4D 4F 4F
  103.  E 0160 54 48 53 43 52 4F 4C 4C 00 00 00 A7 88 04 00 00
  104.  E 0170 A2 01 D1 A0 8D 00 01 00 00 55 8B EC 06 56 33 C0
  105.  E 0180 8E C0 8B 76 08 8B 04 33 D2 26 8B 1E 85 04 F7 F3
  106.  E 0190 8B D8 8B CA 26 A1 4A 04 D0 E4 F7 E3 8B 76 06 8B
  107.  E 01A0 1C D1 EB D1 EB D1 EB 03 D8 26 8B 16 63 04 83 C2
  108.  E 01B0 06 EC EB 00 A8 08 74 F9 EC EB 00 A8 08 75 F9 26
  109.  E 01C0 8B 16 63 04 B0 0D EE 42 8A C3 EE 4A B0 0C EE 42
  110.  E 01D0 8A C7 EE 4A 83 C2 06 EC EB 00 A8 08 74 F9 83 EA
  111.  E 01E0 06 B0 08 EE 8A C1 42 EE 83 C2 05 EC BA C0 03 B0
  112.  E 01F0 33 EE 8B 76 06 8B 04 24 07 EE 5E 07 8B E5 5D CA
  113.  E 0200 04 00 F5 8A 02 00 00 74
  114.  RCX
  115.  0108
  116.  W
  117.  Q
  118.  
  119. '========  end of Debug Script ========
  120. }
  121.  
  122.